
CC = CXX

CXXFLAGS = -g -gdwarf-2 -Wall
RM = rm -f

.PHONY : clean distclean run debug test

main: main.o lexical.o
	$(CXX) $(CXXFLAGS) -o main main.o lexical.o

lexical.cpp: slang.l
	lex -o lexical.cpp slang.l

main.hpp: slang.y
	yacc -o main.cpp -d slang.y

main.cpp: slang.y
	yacc -o main.cpp -d slang.y

clean:
	$(RM) *.o main

distclean: clean
	$(RM) lexical.cpp main.hpp main.cpp *~ *.kdevelop.filelist *.kdevelop.pcs *.kdevses

run: main
	./main

debug: main
	gdb main

test: main
	./main < teste1.txt
	./main < teste2.txt
	./main < teste3.txt
	./main < teste4.txt
	./main < teste5.txt
	./main < teste6.txt
